import { AmqpClientService } from '@app/amqp-client';
import { Injectable } from '@nestjs/common';

@Injectable()
export class AmqpService {
	constructor(
		private readonly amqpClient:AmqpClientService
	) {
		amqpClient.on('message', this.message)
	}

	public message(context) {
		var msg = context.message;
        //callback(msg.application_properties.topic, Buffer.from(msg.body.content).toString(), msg.message_id)
        //发送ACK，注意不要在回调函数有耗时逻辑。
        context.delivery.accept();
	}
}
